<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      const promise = new Promise((resolve, reject) => {
        setTimeout(() => {
          console.log('timerStart') 
          resolve('success')
          const pe = new Promise((resolve, reject) => {
            reject('ss')
            resolve('cc')
          })
          console.log('timerEnd') 
          resolve('error')
          console.log(4) 
          pe.then((res) => {
            console.log('erEnd')
          }).catch((res) => {
            console.log(res) 
          })
        }, 0)
      })
      promise.then((res) => {
        setTimeout(() => {
          console.log(1) 
          console.log('t') 
          const e = new Promise((resolve, reject) => {
            reject('ss') 
            console.log(2) 
            resolve('cc')
          })
          console.log(res) 
          e.then((e) => {
            console.log(e)
            console.log(2)
          })
            .catch((e) => {
              console.log(e)
              return 666
            })
            .then((res) => {
              console.log(res)
              return 666
            })
            .then((res) => {
              console.log(res)
              console.log(1232)
            })
          console.log('ti')
        }, 0)
        console.log(res) // 5
        console.log(1232)
      })
      console.log(123)
    </script>
     123,timerStart,timerEnd,4,erEnd,ss
  </body>
</html>
